package com.hunttown.mes.rpc.domain.enums.admin;

import java.util.HashMap;
import java.util.Map;

/**
 * 员工级别 枚举
 * created by wangjunfu on 2019/4/28
 */
public enum StaffLevelEnum {
    S0(0, "保密"),
    M1(1, "M1"),
    M2(2, "M2"),
    M3(3, "M3"),
    M4(4, "M4"),
    M5(5, "M5"),
    M6(6, "M6"),
    T1(7, "T1"),
    T2(8, "T2"),
    T3(9, "T3"),
    T4(10, "T4"),
    T5(11, "T5"),
    T6(12, "T6"),
    T7(13, "T7"),
    T8(14, "T8"),
    T9(15, "T9"),
    T10(16, "T10"),
    T11(17, "T11"),
    T12(18, "T12"),
    P1(19, "P1"),
    P2(20, "P2"),
    P3(21, "P3"),
    P4(22, "P4"),
    P5(23, "P5"),
    P6(24, "P6"),
    P7(25, "P7"),
    P8(26, "P8"),
    P9(27, "P9"),
    P10(28, "P10"),
    P11(29, "P11"),
    P12(30, "P12");

    private final int key;
    private final String value;

    StaffLevelEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    // 根据key获取枚举
    public static String getEnumByKey(int key) {
        String value = "";

        for (StaffLevelEnum temp : StaffLevelEnum.values()) {
            if (temp.getKey() == key) {
                value = temp.getValue();
            }
        }

        return value;
    }

    // 将枚举组成Map
    public static Map<Integer, String> getEnumList() {
        Map<Integer, String> map = new HashMap<>();

        for (StaffLevelEnum temp : StaffLevelEnum.values()) {
            map.put(temp.getKey(), temp.getValue());
        }

        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}